#pragma once

#include <string.h>
#include <iostream>
#include <assert.h>
using std::cin;
using std::cout;
using std::endl;

namespace BLZ
{
	class string
	{
	private:
		char* _str;
		size_t _size;
		size_t _capa;
	public:
		typedef char* iterator;
		typedef const char* const_iterator;

		string(const char* str = "")
			:_size(strlen(str))
		{
			_capa = _size + 1;
			_str = new char[_capa];
			strcpy(_str, str);
		}
		~string()
		{
			delete[] _str;
			_str = nullptr;
			_capa = 0;
			_size = 0;
		}
		const char* c_str() const;
		char& operator[] (size_t i);
		const char& operator[](size_t i) const;
		iterator begin();
		iterator end();
		const_iterator begin() const;
		const_iterator end() const;
		size_t size() const;
		void reserve(size_t n);
		void push_back(char c);
		void append(const char* s);
		string& operator+=(char c);
		string& operator+=(const char* s);
	};
}